package beatbox;

import com.illposed.osc.*;
import java.util.Observable;
/**Listens for OSC messages to get
 * the current input level (from the mic).
 * uses inputListener.ck
 *
 * Input level is stored in this.last;
 *
 * @requires inputListener.ck is chucked
 * @author Kyle
 */
public class ADCListener extends Observable implements OSCListener {
    private float last = 0; //adc.last
    @Override
    public void acceptMessage(java.util.Date time, OSCMessage message) {
        last = (Float) message.getArguments()[0];
        startNotification();
    }

    /**
     * @return the last adc level
     */
    public float getLast() {
        return last;
    }

    public void startNotification() {
        setChanged();
        notifyObservers();
    }

}
